#ifndef __layout_h__
#define __layout_h__

#include "define.h"
#include <vector>

namespace core
{



class FaceStyle;
/*
 * @brief: layout functions
 */
class LayoutHelper
{
public:
    static bool  GetBackgroundRect( const FaceStyle &style, const rect &border, rect &background );
    static dword GetFitType( const FaceStyle &style );
    static dword GetPositionType( const FaceStyle &style );
    static int  GetBaseline( FaceWindow &control, bool exclude );
    static int  GetColumnline( FaceWindow &control, bool exclude );
};





/*
 * @brief: stream layout
 */
class FaceStreamLayout
{
public:
    FaceStreamLayout();

    bool BeforeBlockLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

    bool AfterBlockLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

    bool BeforeInlineLayout
        (
          layout &parent_layout,
          FaceWindow &control
         );

    bool AfterInlineLayout
        (
          layout &parent_layout,
          FaceWindow &control
         );

protected:
    bool BeforeAbsoluteLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

    bool BeforeRelativeLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

    bool AfterAbsoluteLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

    bool AfterRelativeLayout
        (
          layout &parent_layout,
          FaceWindow &control,
          rect &boundary,
          rect &border,
          rect &content,
          layout &this_layout
         );

private:
    DISABLE_COPY_AND_ASSIGN(FaceStreamLayout)
};



};

#endif